Page History: Scripting Function Reference
Compare Page Revisions
Page Revision: 2011/07/21 22:17
Fields
Fields are values that can be referenced directly in a script. For example
CLOSE
(or
C
in shorthand) represents the closing price of the current bar of the calculation.
Field | Description |
---|
OPEN, O | Opening price |
HIGH, H | High price |
LOW, L | Low price |
CLOSE, C | Closing price |
TYPICAL, TYP | Typical price (O + H +C) / 3 |
VOLUME, V | Volume |
TRADES | Number of trades that make up the current bar (Note: this is not always available yet.) |
INDEX | Index of the current bar being computed. This runs from 0 to COUNT - 1. |
COUNT | Number of bars on the chart. |
BARPERCENT | Percentage completion of the current bar. E.g. 15 minutes into a 1 hour bar would give 0.25 |
NUMERATOR | The numerator of the market. |
DENOMINATOR | The denominator of the market. |
TICKVALUE | The tick value of the market. |
NIL | Special "non-value" field. |
MARKETID | The text market id. |
MARKETDESCRIPTION | The text description of the market. |
Operators
Arithmetic OperatorsOperator | Description |
---|
+ | Add |
- | Subtract |
/ | Divide |
* | Multiply |
% | Modulus |
^ | Exponent |
Relational OperatorsOperator | Description |
---|
=, != | Equals, not equals |
<, <= | Less than, less than equals |
>, >= | Greater than, greater than equals |
Boolean OperatorsOperator | Description |
---|
AND, && | Logical AND |
OR, || | Logical OR |
XOR | Exclusive OR |
Functions
Mathematical FunctionsFunction | Description |
---|
ABS( <value> ) | Calculates the absolute value of a number. |
ACCUM( <value> ) | Accumulates (sums) a value over all the data points on the chart. |
ACOS( <value> ) | Computes the inverse cosine of the value. |
ASIN( <value> ) | Computes the inverse sin of the value. |
ATAN( <value> ) | Computes the inverse tan of the value. |
CEILING( <value> ) | Computes the nearest larger integer to the value. |
COS( <value> ) | Computes the cosine of the value. |
FLOOR( <value> ) | Computes the nearest smaller integer to the value. |
HIGHEST( <value>, <periods> ) | Retrieves the highest value occurring over the last number of periods from the current data point. |
LASTVAL( <value>, <periods> ) | Retrieves the nearest non-Nil value over the last number of periods for the current data point. |
LN( <value> ) | Computes the natural (base e) logarithm of the value. |
LOG( <value>, <base> ) | Computes the logarithm of the value in the specified base. |
LOG10( <value> ) | Computes the base 10 logarithm of the value. |
HIGHEST( <value>, <periods> ) | Retrieves the lowest value occurring over the last number of periods from the current data point. |
MAX( <value 1>, ... <value n> ) | Returns the largest of the specified values. |
MIN( <value>, ... <value> ) | Returns the smallest of the specified values. |
MOD( <value1>, <value2> ) | Returns the remainder of the division of value1 by value2. |
SQRT( <value> ) | Calculates the square root of a number. |
TAN( <value> ) | Calculates the tangent of the value. |
Plotting, Summary and Configuration Functions¶
Function | Description |
---|
PLOT_LINE( <value>, <line thickness>, <line color> ) | Draws a line plot of the value. |
PLOT_HISTOGRAM( <value>, <column width%>, <column color> ) | Draws a histogram (columnar) plot of the value. |
SUMMARY( <formatting text>, [<value>, <value>, ...] ) | Displays a summary for the plot. |